]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
authPrompt: Don't begin a new authentication session on lockscreen cancel event
authorMarco Trevisan (Treviño) <mail@3v1n0.net>
Sat, 30 Jan 2021 03:18:32 +0000 (04:18 +0100)
committerMarge Bot <marge-bot@gnome.org>
Fri, 12 Feb 2021 20:26:00 +0000 (20:26 +0000)
When a cancel event in the user lockscreen happens we first emit a reset
signal and immediately a cancelled one.

This lead to start a new gdm worker for each enabled authentication
method and then immediately to stop it.
As per the previous commit, we don't have anymore dangling gdm workers
around, but still we should not even start a new one in such case.

So, when the user explicitly cancelled the authentication session, first
emit a cancelled event and only emit a reset event with a begin request
if we are outside the lockscreen.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1622>

js/gdm/authPrompt.js

index 49342900052daf262b280adde03822e70334ad42..43798b3b4b7c747be0f515d06cd4e91f808543db 100644 (file)
@@ -29,6 +29,7 @@ var AuthPromptStatus = {
     VERIFYING: 1,
     VERIFICATION_FAILED: 2,
     VERIFICATION_SUCCEEDED: 3,
+    VERIFICATION_CANCELLED: 4,
 };
 
 var BeginRequestType = {
@@ -479,12 +480,16 @@ var AuthPrompt = GObject.registerClass({
 
         if (oldStatus == AuthPromptStatus.VERIFICATION_FAILED)
             this.emit('failed');
+        else if (oldStatus === AuthPromptStatus.VERIFICATION_CANCELLED)
+            this.emit('cancelled');
 
         let beginRequestType;
 
         if (this._mode == AuthPromptMode.UNLOCK_ONLY) {
             // The user is constant at the unlock screen, so it will immediately
             // respond to the request with the username
+            if (oldStatus === AuthPromptStatus.VERIFICATION_CANCELLED)
+                return;
             beginRequestType = BeginRequestType.PROVIDE_USERNAME;
         } else if (this._userVerifier.serviceIsForeground(OVirt.SERVICE_NAME) ||
                    this._userVerifier.serviceIsForeground(Vmware.SERVICE_NAME) ||
@@ -540,7 +545,7 @@ var AuthPrompt = GObject.registerClass({
         if (this.verificationStatus == AuthPromptStatus.VERIFICATION_SUCCEEDED)
             return;
 
+        this.verificationStatus = AuthPromptStatus.VERIFICATION_CANCELLED;
         this.reset();
-        this.emit('cancelled');
     }
 });